<?php

// This is a PLUGIN TEMPLATE.

// Copy this file to a new name like abc_myplugin.php.  Edit the code, then
// run this file at the command line to produce a plugin for distribution:
// $ php abc_myplugin.php > abc_myplugin-0.1.txt

// Plugin name is optional.  If unset, it will be extracted from the current
// file name. Plugin names should start with a three letter prefix which is
// unique and reserved for each plugin author ("abc" is just an example).
// Uncomment and edit this line to override:
$plugin['name'] = 'msd_google_map';

// Allow raw HTML help, as opposed to Textile.
// 0 = Plugin help is in Textile format, no raw HTML allowed (default).
// 1 = Plugin help is in raw HTML.  Not recommended.
# $plugin['allow_html_help'] = 1;

$plugin['version'] = '1.4';
$plugin['author'] = 'Matt Davis';
$plugin['author_uri'] = 'http://photographdaddy.com';
$plugin['description'] = 'Associate location information for an article.';

// Plugin load order:
// The default value of 5 would fit most plugins, while for instance comment
// spam evaluators or URL redirectors would probably want to run earlier
// (1...4) to prepare the environment for everything else that follows.
// Values 6...9 should be considered for plugins which would work late.
// This order is user-overrideable.
$plugin['order'] = '5';

// Plugin 'type' defines where the plugin is loaded
// 0 = public       : only on the public side of the website (default)
// 1 = public+admin : on both the public and admin side
// 2 = library      : only when include_plugin() or require_plugin() is called
// 3 = admin        : only on the admin side
$plugin['type'] = '1';

// Plugin "flags" signal the presence of optional capabilities to the core plugin loader.
// Use an appropriately OR-ed combination of these flags.
// The four high-order bits 0xf000 are available for this plugin's private use
if (!defined('PLUGIN_HAS_PREFS')) define('PLUGIN_HAS_PREFS', 0x0001); // This plugin wants to receive "plugin_prefs.{$plugin['name']}" events
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) define('PLUGIN_LIFECYCLE_NOTIFY', 0x0002); // This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events

$plugin['flags'] = '1';

if (!defined('txpinterface'))
        @include_once('zem_tpl.php');

# --- BEGIN PLUGIN CODE ---
##################
#
#	msd_google_map for Textpattern
#	version 1.4
#	by Matt Davis
#	http://photographdaddy.com
#
# 	Change Log
#	v0.2 - added geocoder to lookup addresses
#	v0.3 - added variables for custom fields to allow them to easily be changed.
#	v0.4 - added [+] and [-] buttons to label per request from candyman 
#	v1.0 - added preferences tab to allow easy update.
#		added ability to select large center column map or small left column map.
#		added various map control and type options.
#	v1.1 - added customizable Marker using mapiconmaker.js 
#	v1.2 - added compatibility with Textpattern 4.0.6
#	v1.3 - added GUnload() to prevent browser memory leaks per Google Documentation.
#	v1.4 - updated help.
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
###################

if (@txpinterface == 'admin')
{
  global $msd_googlemapsapikey, $msd_coord1, $msd_coord2, $msd_start, 
            $msd_mapplacement, $msd_mapType, $msd_control, $msd_zoom,
            $msd_marker_type, $msd_marker_width, $msd_marker_height,
            $msd_marker_primary_color, $msd_marker_stroke_color,
            $msd_marker_corner_color;
            
	if (!isset($msd_googlemapsapikey)) {
		$msd_googlemapsapikey = "API-KEY";
		$msd = safe_insert('txp_prefs', "name='msd_googlemapsapikey', val='$msd_googlemapsapikey', prefs_id='1'");
	}

	if (!isset($msd_coord1)) {
		$msd_coord1 = "custom-1";
		$msd = safe_insert('txp_prefs', "name='msd_coord1', val='$msd_coord1', prefs_id='1'");
	}

	if (!isset($msd_coord2)) {
		$msd_coord2 = "custom-2";
		$msd = safe_insert('txp_prefs', "name='msd_coord2', val='$msd_coord2', prefs_id='1'");
	}
	if (!isset($msd_start)) {
		$msd_start = "36.54494944148322,-121.8658447265625";
		$msd = safe_insert('txp_prefs', "name='msd_start', val='$msd_start', prefs_id='1'");
	}
	
		if (!isset($msd_mapplacement)) {
		$msd_mapplacement = 1;
		$msd = safe_insert('txp_prefs', "name='msd_mapplacement', val='$msd_mapplacement', prefs_id='1'");
	}
	if (!isset($msd_mapType)) {
		$msd_mapType = 0;
		$msd = safe_insert('txp_prefs', "name='msd_mapType', val='$msd_mapType', prefs_id='1'");
	}
	if (!isset($msd_control)) {
		$msd_control= 0;
		$msd = safe_insert('txp_prefs', "name='msd_control', val='$msd_control', prefs_id='1'");
	}
  	if (!isset($msd_zoom)) {
		$msd_zoom= 13;
		$msd = safe_insert('txp_prefs', "name='msd_zoom', val='$msd_zoom', prefs_id='1'");
	}
  
    	if (!isset($msd_marker_type)) {
		$msd_marker_type= 0;
		$msd = safe_insert('txp_prefs', "name='msd_marker_type', val='$msd_marker_type', prefs_id='1'");
	}  	
      if (!isset($msd_marker_width)) {
		$msd_marker_width= 32;
		$msd = safe_insert('txp_prefs', "name='msd_marker_width', val='$msd_marker_width', prefs_id='1'");
	}  	
      if (!isset($msd_marker_height)) {
		$msd_marker_height= 32;
		$msd = safe_insert('txp_prefs', "name='msd_marker_height', val='$msd_marker_height', prefs_id='1'");
	}  	
      if (!isset($msd_marker_primary_color)) {
		$msd_marker_primary_color= '#FF0000';
		$msd = safe_insert('txp_prefs', "name='msd_marker_primary_color', val='$msd_marker_primary_color', prefs_id='1'");
	}  	
      if (!isset($msd_marker_stroke_color)) {
		$msd_marker_stroke_color= '#000000';
		$msd = safe_insert('txp_prefs', "name='msd_marker_stroke_color', val='$msd_marker_stroke_color', prefs_id='1'");
	}  	
      if (!isset($msd_marker_corner_color)) {
		$msd_marker_corner_color= '#FFFFFF';
		$msd = safe_insert('txp_prefs', "name='msd_marker_corner_color', val='$msd_marker_corner_color', prefs_id='1'");
	}

	
	// 'msd_google_map_setup' will be called to handle the 'msd_google_map' event
	register_callback("msd_google_map_setup", "msd_google_map");

	register_callback('msd_google_map_admin', 'article');
	ob_start('msd_google_map_admin');
	add_privs('msd_google_map', 1);
	register_tab("extensions", "msd_google_map", "Article Location");
	}else{
if(gps('msd_google_map_js')) msd_google_map_js(gps('msd_google_map_js'));
}


	function msd_google_map_admin($buffer)
{
		global $msd_googlemapsapikey, $msd_coord1, $msd_coord2, $msd_start, 
            $msd_mapplacement, $msd_mapType, $msd_control, $msd_zoom,
            $msd_marker_type, $msd_marker_width, $msd_marker_height,
            $msd_marker_primary_color, $msd_marker_stroke_color,
            $msd_marker_corner_color;
            
if ($msd_googlemapsapikey!="API-KEY" && $msd_googlemapsapikey!=""){
$find = '</head>';
$replace='<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key='.$msd_googlemapsapikey.'">'."\n";
$replace.='</script>'."\n";
$replace.='<script type="text/JavaScript" src="'.hu.'?msd_google_map_js=mapiconmaker_packedjs"></script>'."\n";


$new = str_replace($find, $replace.$find, $buffer);
if ($msd_mapplacement == 1){
if (version_compare(txp_version, '4.0.6', '>')){
$find2 = '<p><label for="body">';
}else{
$find2 = '<p><textarea id="body" name="Body" cols="55" rows="31" tabindex="2"></textarea></p>';
}
}else{
$find2 = '<p><label for="keywords">'; //sideb ar
}
$replace2='<p id="msd_google_map"><label for="map">'.gTxt("Map").'[+]</label><br /><div id="map_container"><div id="map" style="width:500px;height:230px;padding:0px;margin:0px;text-align:left;"></div></p>'."\n";
$replace2.='<p><label>Address Lookup</label><br />'."\n";
$replace2.='<input id="address" type="text" size="60" name="address" class="edit"/>'."\n";
$replace2.='<input type="button" value="Lookup" onclick="showAddress();"/>'."\n";
$replace2.='</p></div>'."\n";
$replace2.='<script type="text/javascript">'."\n";
$replace2.='//<![CDATA['."\n";
$replace2.='$(window).unload(GUnload());'."\n";
$replace2.='$("#msd_google_map").click(function () {'."\n";
$replace2.='$("#map_container").toggle();'."\n";
$replace2.='if ($("#msd_google_map").text()=="Map[+]"){'."\n";
$replace2.='$("#msd_google_map").text("Map[-]");'."\n";
$replace2.='}else{'."\n";
$replace2.='$("#msd_google_map").text("Map[+]");'."\n";
$replace2.='}'."\n";
$replace2.='});'."\n";
$replace2.='$("#map_container").hide();'."\n";
if ($msd_mapplacement == 1){
$replace2.='var map = new GMap2(document.getElementById("map"),  { size: new GSize(500,230) } );'."\n";
}else{
$replace2.='var map = new GMap2(document.getElementById("map"),  { size: new GSize(160,130) } );'."\n";
}
if ($msd_mapType==1){
$replace2.='map.setMapType(G_SATELLITE_MAP);'."\n";
}else if ($msd_mapType==2){
$replace2.='map.setMapType(G_HYBRID_MAP);'."\n";
}else{
$replace2.='map.setMapType(G_NORMAL_MAP);'."\n";
}
//ICON
$replace2.='var iconOptions = {'."\n";
$replace2.='width: "32",'."\n";
$replace2.='height: "32",'."\n";
$replace2.='primaryColor: "ff0000",'."\n";
$replace2.='cornerColor: "ffffff",'."\n";
$replace2.='strokeColor: "000000"'."\n";
$replace2.='};'."\n";
$replace2.='iconOptions.width = "'.$msd_marker_width.'";'."\n";
$replace2.='iconOptions.height = "'.$msd_marker_height.'";'."\n";
$replace2.='iconOptions.primaryColor = "'.$msd_marker_primary_color.'";'."\n";
$replace2.='iconOptions.cornerColor = "'.$msd_marker_corner_color.'";'."\n";
$replace2.='iconOptions.strokeColor = "'.$msd_marker_stroke_color.'";'."\n";
$replace2.='var icon = MapIconMaker.createMarkerIcon(iconOptions);'."\n";

$replace2.='var mypoint;'."\n";
$replace2.='var myMarker;'."\n";
$replace2.='var geocoder = null;'."\n";
$replace2.='geocoder = new GClientGeocoder();'."\n";
$replace2.='if (document.getElementById("'.$msd_coord1.'").value!==""  && document.getElementById("'.$msd_coord2.'").value!=="" ){'."\n";
$replace2.='x = document.getElementById("'.$msd_coord1.'").value;'."\n";
$replace2.='y = document.getElementById("'.$msd_coord2.'").value;'."\n";
$replace2.='map.setCenter(new GLatLng(x,y), 13);'."\n";
$replace2.='mypoint= new GLatLng(x,y);'."\n";
$replace2.='}else{'."\n";
$replace2.='mypoint = new GLatLng('.$msd_start.');'."\n";
$replace2.='map.setCenter(mypoint,1);'."\n";
$replace2.='}'."\n";
$replace2.='mymarker = new GMarker(mypoint, {icon: icon});'."\n";
$replace2.='map.addOverlay(mymarker);'."\n";
if ($msd_control==1){//"GSmallMapControl","GSmallZoomControl","GSmallZoomControl3D"
$replace2.='map.addControl(new GSmallZoomControl());'."\n";
}else if ($msd_control==2){
$replace2.='map.addControl(new GSmallZoomControl3D());'."\n";
}else{
$replace2.='map.addControl(new GSmallMapControl());'."\n";
}
$replace2.='GEvent.addListener(map,"click", function(overlay, point) {'."\n";
$replace2.='if (overlay) {'."\n";
$replace2.='map.removeOverlay(overlay);'."\n";
$replace2.='} else if (point) {'."\n";
$replace2.='map.panTo(point);'."\n";
$replace2.='mymarker.setLatLng(point);'."\n";
$replace2.='map.addOverlay(mymarker);'."\n";
$replace2.='}'."\n";
$replace2.='});'."\n";
$replace2.='GEvent.addListener(map,"click", function(overlay, latlng) {'."\n";
$replace2.='if (latlng) {'."\n";
$replace2.='document.getElementById("'.$msd_coord1.'").value=latlng.lat();'."\n";
$replace2.='document.getElementById("'.$msd_coord2.'").value=latlng.lng();'."\n";
$replace2.='}'."\n";
$replace2.='});'."\n";
$replace2.=''."\n";
$replace2.='function showAddress() {'."\n";
$replace2.='var address=document.getElementById("address").value;'."\n";
$replace2.='if (geocoder) {'."\n";
$replace2.='geocoder.getLatLng('."\n";
$replace2.='address,'."\n";
$replace2.='function(point) {'."\n";
$replace2.='if (!point) {'."\n";
$replace2.='alert(address + " not found");'."\n";
$replace2.='} else {'."\n";
$replace2.='map.setCenter(point, '.$msd_zoom.');'."\n";
$replace2.='//var marker = new GMarker(point);'."\n";
$replace2.='mymarker.setLatLng(point);'."\n";
$replace2.='//map.addOverlay(marker);'."\n";
$replace2.='document.getElementById("'.$msd_coord1.'").value=point.lat();'."\n";
$replace2.='document.getElementById("'.$msd_coord2.'").value=point.lng();'."\n";
$replace2.=''."\n";
$replace2.='}'."\n";
$replace2.='}'."\n";
$replace2.=');'."\n";
$replace2.='}'."\n";
$replace2.='}'."\n";
$replace2.='//]]>'."\n";
$replace2.='</script>'."\n";
}else{
$find = '<td id="messagepane">';
$replace='msd_google_map: Google Maps API Key is not set.'."\n";
return str_replace($find, $find.$replace, $buffer);

}


return str_replace($find2, $replace2.$find2, $new);
}

function msd_google_map_setup($event, $step) {
    global $msd_googlemapsapikey, $msd_coord1, $msd_coord2, $msd_start, 
            $msd_mapplacement, $msd_mapType, $msd_control, $msd_zoom,
            $msd_marker_type, $msd_marker_width, $msd_marker_height,
            $msd_marker_primary_color, $msd_marker_stroke_color,
            $msd_marker_corner_color;

	include(txpath . '/include/txp_prefs.php');

  if (ps("save")) {
	prefs_save();
	header("Location: index.php?event=msd_google_map");
  }

  pagetop("Article Location Preferences");
$msd_mapTypes = array(gTxt("Normal"),gTxt("Satelitte"),gTxt("Hybrid"));
$msd_controls = array(gTxt("Zoom and Pan"),gTxt("Basic Zoom"),gTxt("3D-style Zoom"));
$msd_zooms = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
  echo form(startTable("list").
  tr(tdcs(hed(gTxt("Article Locations Preferences"),1),2)).
  tr(tdcs(hed(gTxt("Set API Key, ID of custom fields used for associating lat/lng with articles and other map settings."),4),2)).
  tr(tda(gTxt("Display Large Map?"), ' style="text-align:right;vertical-align:middle"').td(yesnoradio("msd_mapplacement",$msd_mapplacement))).
  tr(tda(href(gTxt("Google Map API Key"), "http://code.google.com/apis/maps/signup.html"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_googlemapsapikey",$msd_googlemapsapikey))).
  tr(tda(gTxt("ID of Latitude Custom Field"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_coord1",$msd_coord1,'20'))).
  tr(tda(gTxt("ID of Longitude Custom Field"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_coord2",$msd_coord2,'20'))).
  tr(tda(gTxt("Starting Coordinates"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_start",$msd_start,'20'))).
  tr(tda(href(gTxt("Map Type"),"http://code.google.com/apis/maps/documentation/reference.html#GMapType.G_NORMAL_MAP"), ' style="text-align:right;vertical-align:middle"').td(selectInput("msd_mapType",$msd_mapTypes,$msd_mapType))).  
  tr(tda(href(gTxt("Control Type"),"http://code.google.com/apis/maps/documentation/reference.html#GControlImpl.GSmallMapControl"), ' style="text-align:right;vertical-align:middle"').td(selectInput("msd_control",$msd_controls,$msd_control))).    
 tr(tda(gTxt("Zoom Level"), ' style="text-align:right;vertical-align:middle"').td(selectInput("msd_zoom",$msd_zooms,$msd_zoom))).    
  //icon
  tr(tda(gTxt("Marker Width"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_marker_width",$msd_marker_width,3))).    
  tr(tda(gTxt("Marker Height"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_marker_height",$msd_marker_height,3))).    
  tr(tda(gTxt("Marker Primary Color"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_marker_primary_color",$msd_marker_primary_color,7))).    
  tr(tda(gTxt("Marker Stroke Color"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_marker_stroke_color",$msd_marker_stroke_color,7))).    
  tr(tda(gTxt("Marker Corner Color"), ' style="text-align:right;vertical-align:middle"').td(text_input("msd_marker_corner_color",$msd_marker_corner_color,7))).    
  
	
  tr(tda(fInput("submit","save",gTxt("save_button"),"publish").eInput("msd_google_map").sInput('saveprefs'), " colspan=\"2\" class=\"noline\"")).
  endTable());
}
//Serve the mapiconmaker_packed.js file
function msd_google_map_js($file=''){
		ob_start();
		ob_end_clean();
        header('Content-type: text/JavaScript');
		$code = 
'ZXZhbChmdW5jdGlvbihwLGEsYyxrLGUscil7ZT1mdW5jdGlvbihjKXtyZXR1cm4oYzxhPycnOmUo
cGFyc2VJbnQoYy9hKSkpKygoYz1jJWEpPjM1P1N0cmluZy5mcm9tQ2hhckNvZGUoYysyOSk6Yy50
b1N0cmluZygzNikpfTtpZighJycucmVwbGFjZSgvXi8sU3RyaW5nKSl7d2hpbGUoYy0tKXJbZShj
KV09a1tjXXx8ZShjKTtrPVtmdW5jdGlvbihlKXtyZXR1cm4gcltlXX1dO2U9ZnVuY3Rpb24oKXty
ZXR1cm4nXFx3Kyd9O2M9MX07d2hpbGUoYy0tKWlmKGtbY10pcD1wLnJlcGxhY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YwMHxEQTcxODd8cHVzaHxtbXx8c2lufGNvc3wxODB8UEl8bWlufDM2MHxlbHNlfGNy
ZWF0ZU1hcmtlckljb258Y3JlYXRlTGFiZWxlZE1hcmtlckljb258MDAwMDAwMDB8c3RhclByaW1h
cnlDb2xvcnxjaHh8ZmZ8aXR8c2hhcGV8bGFiZWxTaXplfHNoYWRvd0NvbG9yfGNoZHB8Y3JlYXRl
RmxhdEljb258ZmZmZmZmfGZDfHRDfGxlbmd0aHxjb3JuZXJDb2xvcnx8TGF1dG98fGVuY29kZVVS
SUNvbXBvbmVudHx8bnVsbHx1bmRlZmluZWR8MzR8MzknLnNwbGl0KCd8JyksMCx7fSkp';
		echo base64_decode($code);
		exit();
		}



# --- END PLUGIN CODE ---
if (0) {
?>
<!--
# --- BEGIN PLUGIN HELP ---
<h1>Article Map</h1>

	<p>This plugin will add a google map to your article tab to assist you with adding lat/lng coordinates to the 2 custom fields. Just click on the desired point on the map to set the location or enter an address in the address field.</p>

	<p>You must set the Google Maps api key for your domain in the <a href="/textpattern/index.php?event=msd_google_map">Article Location tab</a> where you can change other options including custom fields used, map type, map control type, and marker color and size. An api key can be obtained at <a href="http://code.google.com/apis/maps/signup.html">Google Maps</a></p>
# --- END PLUGIN HELP ---
-->
<?php
}
?>